package com.rayboo.example.design.pattern.factory.abs;

public class Factory {

    public static final String SUV = "suv";
    public static final String MPV = "mvp";

    // 返回值 CarFactory 是接口
    public CarFactory create(String type) {
        if (SUV.equals(type)) {
            return new SuvCarFactory();
        } else if (MPV.equals(type)) {
            return new MpvCarFactory();
        } else {
            throw new RuntimeException("No " + type + " car factory.");
        }
    }
}
